/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.financial.store;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.T800;
import queenb.web.financial.inteface.FinancialExpectedInf;
import queenb.web.util.PackageContants;


/**
 *
 * @author Ka
 */
public class T800Store extends T800 implements FinancialExpectedInf{
       
    @Override
    public int updateT800(
             int pnPT800, 
             int pnFH075, 
             int pnFT000,
             double pnTN801,
             String pvTV802,
             Date pdTD803,
             Date pdTD804,
             String pvTV805,
             String pvTV806,
             String pvTV807,
             String pvTV808,
             int pnTN809,
             int pnFV500,
             int pnFB050,
             int pnPT075,
             int pnFH000,
             int pnFH200,
             String pvLogin
            ){
        try {
        DataStatement dataStatement = new DataStatement(PackageContants.UPDATE_T800, OracleTypes.INTEGER, 
                 new Param[]{
                    new Param(OracleTypes.INTEGER, pnPT800),
                    new Param(OracleTypes.INTEGER, pnFH075),
                    new Param(OracleTypes.INTEGER, pnFT000),
                    new Param(OracleTypes.DOUBLE, pnTN801),
                    new Param(OracleTypes.CHAR, pvTV802),
                    new Param(OracleTypes.DATE, pdTD803),
                    new Param(OracleTypes.DATE, pdTD804),
                    new Param(OracleTypes.CHAR, pvTV805),
                    new Param(OracleTypes.CHAR, pvTV806),
                    new Param(OracleTypes.CHAR, pvTV807),
                    new Param(OracleTypes.CHAR, pvTV808),
                    new Param(OracleTypes.INTEGER, pnTN809),
                    new Param(OracleTypes.INTEGER, pnFV500),
                    new Param(OracleTypes.INTEGER, pnFB050),
                     new Param(OracleTypes.INTEGER, pnPT075),
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.CHAR, pvLogin),
                 });
        
           return super.update(dataStatement, T800.class);
        } catch (SQLException ex) {
            Logger.getLogger(T800Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }

    public int deleteT800(int pnPT800, String pvLOGIN) {
        DataStatement dataStatement = new DataStatement(PackageContants.DELETE_T800, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnPT800),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });
        try {
            return super.update(dataStatement, T800.class);
        } catch (SQLException ex) {
            Logger.getLogger(FinancialStore.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }
    
    @Override
    public List<T800> listT800(
            int pnFH000,
            int pnFH200,
            int pnPT800,
            int pnFH075,
            int pnFT000,
            int pnFB050,
            int pnFV500,
            int pnOFFSET,
            int pnLIMIT,
            int pnSORT,
            int pnDIRECT,
            String pvLOGIN)
    
    {
        
        try {
            DataStatement dataStatement = new DataStatement(PackageContants.LIST_T800, OracleTypes.CURSOR, new Param[]{
                        new Param(OracleTypes.INTEGER, pnFH000),
                        new Param(OracleTypes.INTEGER, pnFH200),
                         new Param(OracleTypes.INTEGER, pnPT800),
                        new Param(OracleTypes.INTEGER, pnFH075),
                        new Param(OracleTypes.INTEGER, pnFT000),
                        new Param(OracleTypes.INTEGER, pnFB050),
                        new Param(OracleTypes.INTEGER, pnFV500),
                        new Param(OracleTypes.INTEGER, pnOFFSET),
                        new Param(OracleTypes.INTEGER, pnLIMIT),
                        new Param(OracleTypes.INTEGER, pnSORT),
                        new Param(OracleTypes.INTEGER, pnDIRECT),
                        new Param(OracleTypes.CHAR, pvLOGIN)});

            return super.find(dataStatement, T800.class);
        } catch (SQLException ex) {
            Logger.getLogger(FinancialStore.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(FinancialStore.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(FinancialStore.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
    
}
